package gui;

import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.Observer;

import javax.swing.JEditorPane;
import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.HTMLEditorKit;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.CharacterData;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

import carnetCommandes.Commande;

import java.util.Observable;

public class GoogleMapPanel extends JEditorPane implements Observer {
	

    private String roadmap = "roadmap";
    private int size = 300;
 

    
   //Mettre le panel en html
    public GoogleMapPanel() {
    	
        HTMLEditorKit kit = new HTMLEditorKit();
        HTMLDocument htmlDoc = (HTMLDocument) kit.createDefaultDocument();
        this.setEditable(false);
        this.setContentType("text/html");
        this.setEditorKit(kit);
        this.setDocument(htmlDoc);
    }

    public void setImage(String urlSiteWeb){
    	
    	 String html = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>";
         html += "<html><head></head><body>";
         html += "<img src='" + urlSiteWeb + "'>";
         html += "</body></html>";
         this.setText(html);
    	
    }

	@Override
	public void update(Observable o, Object arg) {
		// TODO Auto-generated method stub
		
		String url = (String) arg;
		setImage(url);
		
	}

}
